export class DanmakuFilter {
  private static readonly SENSITIVE_WORDS = [
    // 添加敏感词列表
  ]

  private static readonly PATTERN = new RegExp(DanmakuFilter.SENSITIVE_WORDS.join('|'), 'gi')

  static filter(content: string): string {
    return content.replace(this.PATTERN, '***')
  }

  static validate(content: string): boolean {
    // 长度检查
    if (content.length < 1 || content.length > 100) {
      return false
    }

    // 内容检查
    if (/^\s*$/.test(content)) {
      return false
    }

    return true
  }
}
